package com.zhxymm.book.service;

import com.zhxymm.book.dao.BorrowRepository;
import com.zhxymm.book.entity.Borrow;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BorrowService {

    @Autowired
    BorrowRepository borrowRepository;


    public Borrow save(Borrow borrow){
        return borrowRepository.save(borrow);
    }

    public List<Borrow> getAll(){
        return borrowRepository.findAll();
    }

    public Borrow findByBookId(long theId) {

        return borrowRepository.findByBookId(theId);
    }

    public void delete(Borrow theBorrow){
        borrowRepository.delete(theBorrow);
    }
}